﻿using System.Collections.Generic;
using System.Xml.Serialization;
using Inkubator.Wizard.Model.Interaction;

namespace Inkubator.Wizard.Model.Model
{
    public class Group : WizardComponent
    {
        /// <summary>
        /// List of item that will be contained inside the component.
        /// </summary>
        public List<string> item;
        /// <summary>
        /// DataSource structure allow you to establish if this component will
        /// be generated based on the data contained in some Data Source.
        /// </summary>
        public DataSource dataSource;
        /// <summary>
        /// Label represent the caption that will identified the component
        /// and will show the user what this component represent.
        /// </summary>
        public string label;

        /// <summary>
        /// This attribute specified if this component will be some of the following ones:
        /// CheckBoxList, ListControl, RadioButtonList, DropDownList
        /// </summary>
        [XmlAttribute("type")]
        public string type;

        public Group() 
        {
            this.item = new List<string>();
        }

        public Group(string type, List<string> array)
        {
            this.type = type;
            this.item = array;
        }

        /*[XmlElement("item")]
        public string[] groupItems
        {
            get
            {
                string[] groupItems = new string[this.item.Count];
                item.CopyTo(groupItems);
                return groupItems;
            }
            set
            {
                if (value == null) return;
                string[] groupItems = (string[])value;
                item.Clear();
                foreach (string items in groupItems)
                    item.Add(items);
            }
        }*/

        public void addItem(string itemGroup)
        {
            this.item.Add(itemGroup);
        }

    }
}
